<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="target-densitydpi=640,width=1280,user-scalable=yes">
    <base href="<?php echo $system['siteRoot'];?>" />
    <title>退货管理</title>
    <?php import_tpl("fragment/icon.php"); ?>
    <link rel="stylesheet" href="plugin/reset.css"/>
    <link rel="stylesheet" href="plugin/awesome4/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="style/common.css"/>
    <link rel="stylesheet" href="style/return-manage.css"/>
    <script src="plugin/jquery-1.11.2.min.js"></script>
    <script type="text/javascript">
    (function(){
        $(function(){
            //console.log( $('.slide .commodity'))
            $('.slide .refund').addClass('menu-normal').removeClass('menu-label')    
        })
    })()
    </script>
    <script type="text/javascript">_root='<?php echo $system['siteRoot'];?>'</script>
    <script src="script/api.js"></script>
    <script src="script/order-refund.js"></script>
</head>
<body>
<div id="container" class="index">
    <?php import_part("custom.home","userBar"); ?>
    <?php import_part("custom.home","header"); ?>
    <?php import_tpl("fragment/nav.php"); ?>
    <div class="main-container">
        <div class="left">
            <?php import_tpl("fragment/mySlide.php"); ?>
            <div class="qr-code-box">
                <img src="images/weixin.png" alt="扫描二维码关注" title="关注我们的微信"/>
                <div>
                    <p class="weixin">扫描二维码</p>
                    <p class="concern">关注我们的微信</p>
                </div>
            </div>
        </div>
        <div class="right">
            <div class="goods-return">
                <div class="goods-return-title">
                    <p>退货管理</p>
                </div>
                <table class="return-detail-table">
                    <tr class="return-detail">
                        <td class="return-number">订单号</td>
                        <td class="present-situation">当前状态</td>
                        <td class="send-time">买家发货时间</td>
                        <td class="return-time">商家确认收到及退款时间</td>
                        <td class="return-operation">操作</td>
                    </tr>
                </table>    
                <table class="return-table">
                    <?php foreach ($r['list'] as $k=>$v) {
                        if($v['type']==0){
                            switch($v['state']){
                                case 'create':$state="已申请，等待商家确认";break;
                                case 'apply':$state="已确认，等待发货";break;
                                case 'shipped':$state="已发货，等待收货";break;
                                case 'confirm':$state="商家已确认，退款成功";break;
                                default:$state='unknown state';
                            }
                        }else{
                            switch($v['state']){
                                case 'create':$state="已申请，等待商家确认";break;
                                case 'apply':$state="已确认，等待商家退款";break;
                                case 'confirm':$state="商家已确认，退款成功";break;
                                default:$state='unknown state';
                            }
                        }

                        ?>
                        <tr class="<?=$k%2==0?'':'even-line' ?>">
                            <td class="return-number"><?=$v['order_id']?></td>
                            <td class="present-situation"><?=$state?><?php if($v['state']=='confirm'){?> <i class="fa fa-check-circle"></i><?php }?></td>
                            <td class="send-time">
                                <?php if($v['type']==0){
                                        if($v['state']=='apply'){ ?>
                                    <a href="javascript:" class="js-refund-record" data-id="<?=$v['id']?>" >录入发货订单号</a>
                                <?php }elseif($v['state']!='apply'&&!empty($v['express_num'])){
                                            $url='http://www.kuaidi100.com/chaxun?com='.$v['express_name'].'&nu='.$v['express_num'];
                                            ?>
                                    <?=$v['shipping_time']?><a href="<?=$url?>" target="_blank" class="check-flow">查看物流</a>
                                <?php }
                                }?>
                            </td>
                            <td class="return-time">
                                <?php if($v['type']==0){ if($v['state']=='shipped'){ ?>
                                    <span class="wait-seller">等待商家收货</span>
                                <?php }elseif($v['state']=='confirm'&&!empty($v['confirm_time'])){?>
                                    <?=$v['confirm_time']?>
                                <?php }
                                }elseif($v['state']=='apply'){?>
                                    <span class="wait-seller">等待商家退款</span>
                                <?php }else{?>
                                    <?=$v['confirm_time']?>
                                <?php }?>
                            </td>
                            <td class="return-operation"><a href="<?php e_page('order','detail',array('id'=>$v['order_id'])) ?>">查看对应订单</a></td>
                        </tr>
                    <?php }?>
                </table>
            </div>
            <?php if($r['page'] instanceof Page && !$r['pageEmpty']){
                $page=$r['page'];?>
                <div class="turn-page">
                    <?php if($page->ifPrev()) { ?>
                        <a href="<?=$page->getPageUrl($page->getPrev());?>"><i class="fa fa-chevron-left"></i>上一页</a>
                    <?php }?>
                    <?php foreach($page->getPageArray() as $i){ ?>
                        <a href="<?=$page->getPageUrl($i);?>"><?php echo $i;?></a>
                    <?php } ?>
                    <?php if($page->ifNext()) { ?>
                        <a href="<?=$page->getPageUrl($page->getNext());?>">下一页<i class="fa fa-chevron-right"></i></a>
                    <?php }?>
                </div>
            <?php } ?>
        </div>
    </div>
    <?php import_tpl("fragment/footer.php"); ?>
</div>
<div class="alert-bg return-order">
    <div class="alert-box">
        <form id="express" action="<?php e_page('orderAfter','refundExpress') ?>" method="post">
            <input type="hidden" id="refund-id" name="refund_id" value="">
            <div class="alert-box-title">填写退货商品运单号<a class="close" href="javascript:"><i class="fa fa-close"></i></a></div>
            <div class="express">
                <label for="express-name">快递公司</label>
                <input type="text" id="express-name" name="express_name" placeholder="EMS/顺丰/中通/圆通/韵达/申通/...">
            </div>
            <div class="return-number">
                <label for="return-number-id">运&nbsp;单&nbsp;号</label>
                <input type="text" id="return-number-id" name="express_num" placeholder="请输入退货商品运单号">
            </div>
            <p>请您核对快递公司和运单号无误后点击“确认”。</p>
            <a href="javascript:" class="info-affirm">确认</a>
        </form>
    </div>
</div>
</body>
</html>